/**
 * User: zsquirrel
 * Date: 2020/5/13
 * Time: 9:20 上午
 */
package com.cskaoyan.mall.model.vo;

import java.sql.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;

/**
 * 商品详情页面评价列表中每个评价的显示
 */
public class GoodsCommentVO {

    private Map user = new HashMap();

    private Double score;

    private Integer id;

    private String specName;

    private String comment;

    private String time;

    private Integer userId;

    /**
     * sql语句有一个字段为nickname，所以会调用里面的setNickname方法
     * @param nickname
     */
    public void setNickname(String nickname){
        user.put("nickname", nickname);
    }


    public Double getScore() {
        return score;
    }

    public void setScore(Double score) {
        this.score = score;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getSpecName() {
        return specName;
    }

    public void setSpecName(String specName) {
        this.specName = specName;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public String getTime() {
        return time;
    }

    /**
     * 数据库里面的time字段是timestamp，转成jdbc就是java.sql.Date
     * @param time
     */
    public void setCommentTime(Date time) {
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        this.time = format.format(time);
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }
}
